<?php echo View::factory('admin/travel/travel_left')->render(); ?>
<script>        
    $(document).ready(function() {
        $('#dialog-form').dialog({ 
            autoOpen: false,
            close: function() {
                $('.edit').removeClass( "ui-state-focus" );
            }

        });
         
        $('.edit_feedback').click(function(){
            $('#dialog-form').dialog('open');
            $.ajax({
                type:"GET",
                url:"/admin/sight/edit_feedback",
                data:'id='+$(this).text(),
                dataType:'json',
                success:function(data) {

                    $('#sightname').val(data['sightname']);
                    $('#id_fb').val(data['id_fb']);
                    $('#answer').text(data['answer']);
                    $('#msg').text(data['msg']);
                    $('#username').val(data['username']);
                    $('.ischeck[value='+data['ischeck']+']').attr('checked','checked');
                    
               
                }
            });
            return false;
        });
        
        $( ".format2" ).buttonset();
        $('.delete').click(function() {
            var del = this;
            deletenotice = "您确定要删除<font color='#FF0084'>" +$('#advid-'+$(del).text()).text() +"</font>吗？";
            $('#delete-notice').html(deletenotice);
            $( "#dialog:ui-dialog" ).dialog( "destroy" );
            $( "#dialog-confirm" ).dialog({
                resizable: false,
                height:140,
                modal: true,
                buttons: {
                    "确定": function() {
                        $( this ).dialog( "close" );
                        var deleteurl = "/admin/sight/del_feedback/"+$(del).text();
                        window.location.href=deleteurl;
                    },
                    "取消": function() {
                        $( this ).dialog( "close" );
                        $('.delete').removeClass('ui-state-focus')
                    }
                }
            });
            return false;
        });
        
        $('#delete-all-submit').button();
        $( ".delete" ).button({
            icons: {
                primary: "ui-icon ui-icon-trash"
            },
            text: false
        });
        $( ".edit" ).button({
            icons: {
                primary: "ui-icon ui-icon-pencil"
            },
            text: false
        });
        $('#add').button({
            icons:{
                primary:"ui-icon ui-icon-plusthick"
            },
            text:true
        });
        $('.archives_cat li').mousemove(function() {
            $('.onhover').removeClass('onhover');
            $(this).addClass('onhover');
        });
        $('.archives_cat li').mouseout(function() {
            $('.onhover').removeClass('onhover');
            
        });
    });
</script>
<div id="dialog-confirm" title="友情提醒" style="display: none">
    <p><span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 20px 0;"></span><span id="delete-notice">您确定要删除该用户吗？</span></p>
</div>
<style>
    .archives_cat span {float: right;white-space: normal;margin: 2px; }
    .archives_cat .advnamecolor{color:#666666;padding-left: 20px;padding-top: 3px;}
    .archives_cat ul li span a{padding:0px;}
    #add_advs {float: right;padding-right: 9px;}
    .archives_cat ul li .advsname { float: left; }
</style>
<div id="do_right" class="catalog_right">
    <div class="box" style="overflow:hidden;">
        <h3 id="h3_left">景点留言列表</h3>
        <div id="add_advs"><a href="/admin/sight/add"><button id="add">添加景点</button></a></div>
        <div class="clear"></div>
        <form action="/admin/sight/delete_all/" name="newslistform" method="post" >
            <table>
                <thead>
                    <tr>
                        <th scope="col">选择</th>
                        <th scope="col">用户</th>
                        <th scope="col">点评</th>
                        <th scope="col">操作</th>
                    </tr>
                </thead>
                <tbody>
                    <?php if (is_array($data)): $i = 0; ?>
                        <?php foreach ($data as $key => $result): ?>
                            <tr <?php if (++$i % 2 == 0): ?>class="odd"<?php endif ?>>
                                <td><span class="format2"  ><input type="checkbox" id="check<?php echo $result->id_fb; ?>" /><label for="check<?php echo $result->id_fb; ?>"><?php echo $result->id_fb; ?></label></span></td>
                                <td><?php echo $result->username ?></td>
                                <td width="60%"><?php echo Stringhelp::cutstr($result->msg, 30, '... ...'); ?></td>
                                <td><a href="/admin/sight/edit/<?php echo $result->id_fb ?>"><button class="edit edit_feedback" type="button"><?php echo $result->id_fb ?></button></a><a href="#" ><button class="delete"><?php echo $result->id_fb ?></button></a></td>
                            </tr>
                        <?php endforeach ?>               
                    <?php endif ?>

                </tbody>
                <tfoot>
                    <tr>
                        <td colspan="5"><input type="submit" name="deletealls" value="删除" id="delete-all-submit" style=" float: left;"/> </td>
                        </td>

                    </tr>
                </tfoot>
            </table>

        </form>
        <div class="archives_cat">
            <?php echo $page_view; ?>
        </div>
    </div>
</div>
<div id="dialog-form" title="编辑景点评论" style="width:400px;">
    <form action="/admin/sight/edit_feedback" method="post" name="form1" id="form1">
        <table border="0" cellpadding="0" cellspacing="0" width="280" style="margin:auto;">
            <tr>
                <td class="tdLabel"><label>景点名称:</label></td>
                <td class="tdInput">
                    <input type="text" id="sightname" name="sightname" class="text" value="" disabled />
                    <input type="hidden" id="id_fb" name="id_fb" class="text" value=""/>
                </td>
            </tr>
            <tr>
                <td class="tdLabel"><label>用户名:</label></td>
                <td class="tdInput"><input type="text" id="username" name="username" class="text" value=""/></td>
            </tr>
            <tr>
                <td class="tdLabel"><label>审核:</label></td>
                <td class="tdInput"><input type="radio" class="ischeck" name="ischeck" value="1"/><label for="ischeck">审核通过</label>
                    <input type="radio" class="ischeck" name="ischeck" value="0"/><label for="ischeck">未通过</label>
                </td>
            </tr>
            <tr>
                <td class="tdLabel"><label>内容:</label></td>
                <td class="tdInput">
                    <textarea name="msg"  id="msg" class="textarea" style="width:200px;height:100px;"></textarea>
                </td>
            </tr>
            <tr>
                <td class="tdLabel"><label>回复:</label></td>
                <td class="tdInput"><textarea name="answer"  id="answer" class="textarea" style="width:200px;height:100px;"></textarea></td>
            </tr>
            <tr>
                <td colspan="2" align="center"><input type="submit" value="修 改"></td>
            </tr>
        </table>
    </form>
</div>